<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>明天云平台-批量支付</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0" name="viewport">
<link rel="stylesheet" href="{{URL::asset('newpay/css/main12.css')}}" type="text/css" />
<link rel="stylesheet" href="{{URL::asset('newpay/css/Reset.css')}}" type="text/css" />
<link rel="stylesheet" href="{{URL::asset('newpay/css/style.css')}}" type="text/css" />
<script language="javascript" src="{{URL::asset('newpay/js/jquery-1.11.3.min.js')}}"></script>
<script language="javascript" src="{{URL::asset('newpay/js/createForm.js')}}"></script>
<script type="text/javascript">
$(function(){
	add();
});
function add(){
	var length = $("#content tr").length;
	var timestamp=new Date().getTime();
	var tr="<tr><td><input type='text' value='"+timestamp+"' name='orderNo"+length+"' size='15px' readonly=true></td>"
		+"<td><input type='text' value='商品名称' name='subject"+length+"' size='15px'/></td>"
		+"<td><input type='text' value='0.01' name='amount"+length+"' size='15px'/></td>"
		+"<td><input type='text' value='商品描述' name='body"+length+"' size='15px'/></td>"
		+"<td><select name='payChannelId"+length+"'><option value='3000000011'>支付宝</option><option value='3000000021'>微信支付</option><option value='3000000031'>银联支付</option></select></td>"
		+"<td><button onclick='pay("+length+")' style='color:#FFFFFF;border:0px solid #fff;cursor:pointer;background:#1a8ae1;padding:3px 7px;border-radius:5px;'>立即支付</button></td>"
		+"</tr>";
	$("#content").append(tr)
}

function remove(obj){
	$("#content").remove($(obj));
}

function pay(i){
	var appid=$("input[name='appid']").val();
	var key=$("input[name='key']").val();
	if(appid==""||key==""||(appid==""&&key=="")){
		alert("请输入应用ID及密钥！")
		return;
	}
	var subject=$("input[name='subject"+i+"']").val();
	var amount=$("input[name='amount"+i+"']").val();
	var orderNo=$("input[name='orderNo"+i+"']").val();
	var body=$("input[name='body"+i+"']").val();
	var childAppid=$("input[name='childAppid']").val();
	var payChannelId=$("select[name='payChannelId"+i+"']").val();
	$.post("payTrade.php",{orderNo:orderNo,subject:subject,amount:amount,body:body,payChannelId:payChannelId,appid:appid,key:key,childAppid:childAppid},function(data){		
		if(payChannelId=="3000000031"){
			window.open("http://trans.itppay.com/newsdk/v1.0/goYinLian_pc/"+data);
		}else{
			onSubmitForm("http://trans.itppay.com/newsdk/api/v1.0/cli/order_pc/0",{"orderInfo":data});
		}
	});
}
</script>
</head>

<body>
   
<!--    <form id="itppay_form" name="itppay_form" action="{{ $url }}" method="post">
        <input type="hidden" name="orderInfo" value="{{ $orderInfo }}">
        <input type="submit" value="正在跳往支付页面...">
    </form>-->
    <script>
       var gourl       = '{{$url}}'+'&callback=?';
       var orderinfo = '{{ $orderInfo }}';
//       $(function(){
//           $.ajax({
//                type:'get',
//                url:gourl ,
//                data:{'orderInfo':orderinfo},
//                dataType:'jsonp',
//                processData: false , 
//                success:function(data){
//                   alert(data);
//               } 
//           })
//       }) 
$(function(){
    $.post(gourl,{'orderInfo':orderinfo},function(data){
        alert(data);
    });
})

//        setTimeout(function(){document.forms['itppay_form'].submit(function(data){
//                alert(data);
//                return false();
//        });}, 2000);
    </script>
<!--<div class="w100 navBD12">
	<div class="w1080 nav12">
		<div class="nav12-left">
			<a href="http://www.itppay.com"><img src="image/logo12.png"></a>
			<img class="hidden-xs" src="{{URL::asset('/newpay/image/logo-tip12.png')}}">
		</div>
		<div class="nav12-right" style="float: right;">
			<img class="show-lg" src="{{URL::asset('/newpay/image/phone12.png')}}">
			<img class="show-xs" src="{{URL::asset('/newpay/image/phone12-xs.png')}}">
		</div>
	</div>
</div>    

<div id="merInfo" align="center" style="padding-bottom:20px;">
	<p><label style="font-size: 16px;">APPID:</label><input type="text" value="0000000022" name="appid" size="15px;" style="border-radius:5px; height: 22px; padding:2px 5px;"/></p>
	<p><label style="font-size: 16px;">CHILDAPPID:</label><input type="text" value="" name="childAppid" style="border-radius:5px; height: 22px; padding:2px 5px;"/></p>
	<p><label style="font-size: 16px;">APPKEY:</label><input type="text" value="e7d4c31780d1379c6af38f82e455967c" name="key" style="border-radius:5px; height: 22px; padding:2px 5px; width:280px;"/></p>
</div>
<table width="80%" border="0" cellspacing="8" cellpadding="0">
  <tr>
    <td width="18%">订单号</td>
    <td width="18%">商品名称</td>
    <td width="18%">订单金额</td>
    <td width="18%">描述</td>
    <td width="11%">支付类型</td>
    <td width="10%">操作</td>
    <td width="7%"><img style="width: 30px;height: 30px; cursor: pointer;" title="添加商品" alt="添加商品" src="image/add.jpg" onClick="add()"></td>
</tr>
<tbody id="content">	
</tbody>
</table> 

底部
<div style="text-align:center; color:#cbcbcb; margin-top:120px; clear:both;">
	<p>京ICP证150892号 京ICP备15001719号－10</p>
	<p>©北京明天动力科技股份有限公司</p>
</div>-->

</body>
</html>
